package com.wrupple.muba.catalogs.client.widgets.fields.column;

import com.google.gwt.cell.client.Cell;
import com.google.gwt.user.cellview.client.Column;
import com.wrupple.muba.catalogs.domain.JsCatalogKey;
import com.wrupple.muba.common.client.FieldConversionStrategy;
import com.wrupple.muba.common.client.JSOHelper;

public class FieldColumn extends Column<JsCatalogKey, Object> {
	protected String id;
	private FieldConversionStrategy cs;

	public FieldColumn(String fieldid, Cell<Object> cell,FieldConversionStrategy cs) {
		super(cell);
		this.id = fieldid;
		this.cs=cs;
	}

	@Override
	public Object getValue(JsCatalogKey object) {
		return JSOHelper.getAttributeAsObject(object, id,cs);
	}

	public String getFieldId() {
		return id;
	}
}